home *** CD-ROM | disk | FTP | other *** search
/ Transactor / Transactor_12_1986_Transactor_Publishing.d64 / kernal who.src2 < prev    next >
Text File  |  2023-02-26  |  1KB  |  42 lines

  1. ; program 2
  2. ; dump screen contents to disk using name found in first variable
  3. ; declared in BASIC program calling this routine. The first variable
  4. ; should be a string variable or the name may be rather strange.
  5. ;
  6. start     ldy #$02     ;offset to string length
  7. lda ($2d),y  ;get string length
  8. beq exit     ;zero length, quit while ahead
  9. pha          ;save length on stack
  10. iny          ;increment index
  11. lda ($2d),y  ;get low address of string
  12. tax          ;put in .x
  13. iny          ;increment index
  14. lda ($2d),y  ;get high order pointer
  15. tay          ;put in .y
  16. pla          ;pull length from stack
  17. jsr $ffbd    ;setnam: set file name
  18. lda #$01     ;logical file #1
  19. ldx #$08     ;device #8
  20. ldy #$02     ;secondary address
  21. jsr $ffba    ;setlfs: set logical file
  22. jsr $ffc0    ;open
  23. bcs exit     ;if carry set then error out
  24. ldx #$01     ;file number
  25. jsr $ffc9    ;chkout: set output channel to file 1
  26. ldy #$00     ;zero index
  27. sty $fd      ;set pointer low byte
  28. lda #$04     ;start of screen high byte
  29. sta $fe      ;set pointer high byte
  30. loop      lda ($fd),y  ;get screen character
  31. jsr $ffd2    ;chrout: output a byte to disk
  32. iny          ;increment index
  33. bne loop     ;not 256 yet?
  34. inc $fe      ;increment high byte of pointer
  35. lda $fe      ;get pointer high byte
  36. cmp #$08     ;done four pages yet?
  37. bcc loop     ;if carry clear then no
  38. lda #$01     ;file number 1
  39. jsr $ffc3    ;close: close the file
  40. exit      jsr $ffe7    ;clall: restore default i/o channels
  41. rts          ;return to basic
  42.